<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta id="viewport" name="viewport" content="width=device-width, initial-scale=1">
    <title></title>
    <script type="text/javascript" src="/assets/js/def.js"></script>
    <script src="/hy5b/t/index.js"></script>
    <script src="/hy5b/t/frontend.js"></script>
    <link rel="stylesheet" href="/assets/lib/bootstrap/css/bootstrap.min.css" />
    <script type="text/javascript" src="./index.js"></script>
  </head>
  <body>
    <div id="data"></div>
    <script>
      var json = {
      "errnum": 0,
      "errmsg": "",
      "result": [
        {"domain_id": 10001, "username": "admin", "password": "password", "identify": 0},
        {"domain_id": 10011, "username": "admin", "password": "qwert", "identify": 0},
        {"domain_id": 10002, "username": "dunchong", "password": "123456", "identify": 2},
        {"domain_id": 10003, "username": "yitian", "password": "ddmser133", "identify": 0},
        {"domain_id": 10004, "username": "hongxi", "password": "qwertyui", "identify": 1},
        {"domain_id": 10005, "username": "guandi", "password": "password", "identify": 0},],
      "other":0
    };

    var oT = new dataTable();
    oT.setHead(["位置域", "用户名", "密码", "身份", "排序"])
      .setColumn(["domain_id", "username", "password",
        {
          key: "identify",
          format: function(value, index) {
            var role = ["超级管理员", "网络管理员", "日志管理员"];
            return (role[value]);
          }
        }, {
          key: 'username',
          mformat: function(value, i, atable) {
            var oret = { val: value }
            if (i > 0 && atable[i - 1].username === value) {
              oret.firstFlag = false;
            } else {
              oret.total = 1;
              for (var j = (i + 1); j < atable.length; j++) {
                if (atable[j].username === value) {
                  oret.total++
                } else {
                  break;
                }
              }
              oret.span = 'row'
              oret.firstFlag = true
            }
            return oret
          }
        }])
      .render(json.result, function(sbody, shtml) {
        $("#data").html(shtml);
      });
    </script>
  </body>
</html>
